﻿using System;
using NHibernate;
using OigSync.Model;
using OigSync.Infrastructure.Repository.Hbm;
using NHibernate.Criterion;

namespace OigSync.Repository.Impl
{
    public class OrderRepositoryImpl : RepositoryHbmImpl<OigSync.Model.Order>, IOrderRepository
    {
        public OigSync.Model.Order GetOrderByOrderLineItemID(String eBayUserID, String orderLineItemID)
        {
            return Session.CreateCriteria(typeof(OigSync.Model.Order))
                .Add(Expression.Eq("eBayUserID", eBayUserID))
                .Add(Expression.Eq("OrderLineItemID", orderLineItemID))
                .UniqueResult<OigSync.Model.Order>();
        }
    }
}